Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: try adding libtool to brew install #301

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

lgray
Copy link
Collaborator

@lgray lgray commented Jun 25, 2024

It's not default with build tools in OS14.

@lgray
Copy link
Collaborator Author

lgray commented Jun 25, 2024

ah, yeah super gross indeed. I think the time has come to CMake fastjet and submit a PR.

@matthewfeickert
Copy link
Member

matthewfeickert commented Sep 15, 2024

So what's confusing to me is that if you check the macos-13 and macos-14/macos-latest environments for HOMEBREW environment variables you get

  • macos-13
HOMEBREW_NO_AUTO_UPDATE=1
HOMEBREW_NO_INSTALL_CLEANUP=1
HOMEBREW_CASK_OPTS=--no-quarantine
  • macos-14
HOMEBREW_REPOSITORY=/opt/homebrew
HOMEBREW_NO_AUTO_UPDATE=1
HOMEBREW_PREFIX=/opt/homebrew
HOMEBREW_NO_INSTALL_CLEANUP=1
HOMEBREW_CASK_OPTS=--no-quarantine
HOMEBREW_CELLAR=/opt/homebrew/Cellar

and in the macos-14 environment none of the brew installed tools are found at configure or compile time. Everything "just works" in the macos-13 runner image.

In macos-13 the homebrew cellar is under /usr/local/Cellar/ while in macos-14 it is under /opt/homebrew/Cellar but that doesn't feel like something that should need to be manually configured to work on the runner. :?

@matthewfeickert
Copy link
Member

@henryiii Have you run into stuff like this before?

@henryiii
Copy link
Member

This is one of two things: everything is now inside /opt/homebrew and GitHub ships a slimmed down image for 14+ that has some homebrew binaries manually removed.

@matthewfeickert
Copy link
Member

matthewfeickert commented Sep 15, 2024

Hm. If I rebase on top of all the other PRs I have open at the moment (#313, #315, #316), I'm able to get things working if before installing in the CI

python -m pip install '.[test]' -v

I manually set the include paths and lib paths for the headers (cgal, gmp, boost) and libraries (gmp) that

fastjet/setup.py

Lines 102 to 107 in 8798649

subprocess.run(
["./autogen.sh"] + args,
cwd=FASTJET,
env=env,
check=True,
)

complains about

export CPPFLAGS="-I$(brew --prefix cgal)/include -I$(brew --prefix gmp)/include -I$(brew --prefix boost)/include"
export LDFLAGS="-L$(brew --prefix gmp)/lib"
python -m pip install '.[test]' -v

and then additionally editing setup.py to (do terrible things and) inject LDFLAGS values into the CXXLFAGS argument to extern/fastjet-contrib's .configure options

@@ -96,7 +96,7 @@ class FastJetBuild(setuptools.command.build_ext.build_ext):
 
             env = os.environ.copy()
             env["CXX"] = env.get("CXX", "g++")
-            env["LDFLAGS"] = env.get("LDFLAGS", "") + f" -Wl,-rpath,{_rpath}"
+            env["LDFLAGS"] = env.get("LDFLAGS", "")
             env["ORIGIN"] = "$ORIGIN"  # if evaluated, it will still be '$ORIGIN'
             subprocess.run(["make", "-j"], cwd=FASTJET, env=env, check=True)
             subprocess.run(["make", "install"], cwd=FASTJET, env=env, check=True)
@@ -106,8 +106,7 @@ class FastJetBuild(setuptools.command.build_ext.build_ext):
                     "./configure",
                     f"--fastjet-config={FASTJET}/fastjet-config",
                     f'CXX={env["CXX"]}',
-                    "CXXFLAGS=-O3 -Bstatic -Bdynamic -std=c++17",
-                    f'LDFLAGS={env["LDFLAGS"]}',
+                    f'CXXFLAGS=-O3 -Bstatic -Bdynamic -std=c++17 {env["LDFLAGS"]}',
                 ],
                 cwd=FASTJET_CONTRIB,
                 env=env,

given that for fastjet-contrib

$ ./configure --help

This is a FastJet-contrib tool to configure the behaviour of
the build and installation.

Usage:
  configure [--help] [--list] [--fastjet-config=FILE] [--prefix=PREFIX] [CXX=...] [CXXFLAGS=...]

The arguments can be the following [default in square brackets]:

  --help            prints this message and exits
  --list            prints the list of existing contribs and exits
  --fastjet-config=FILE  
                    sets the 'fastjet-config' file to use [fastjet-config]
  --prefix=PREFIX   sets the installation directory [prefix returned by fastjet-config]
  --only=Contrib1,Contrib2,... 
                    only configures for compilation selected contribs 
  --exclude=Contrib1,Contrib2,...
                    excludes selected contribs from configuration

But manually setting these flags for compilation in CI jobs seems very bad, so there has to be some centralized way of informing the OS where to look for Homebrew installed headers and libraries. (Though I don't know how development on macOS works in general. 🤷)

edit: TIL that Homebrew has include and lib dirs under $(brew --prefix) 👍 so

export CPPFLAGS="-I$(brew --prefix)/include"
export LDFLAGS="-L$(brew --prefix)/lib"
python -m pip install '.[test]' -v

works. I should have guessed that pattern. Though it would still be good to update this globally for the macos-14 runners.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants